package config

import (
	"github.com/spf13/viper"
	"log"
)

type Viper struct {
	MysqlConfig struct {
		User string
		Pass string
		Host string
		Port int
		Data string
	}
	Oss struct {
		Id  string
		Aks string
	}
}

var Conf Viper

func Init() {
	viper.SetConfigFile("./config/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		panic(err)
	} else {
		log.Println("配置读取文件成功")
	}
	err = viper.Unmarshal(&Conf)
	if err != nil {
		panic(err)
	} else {
		log.Println("解析配置文件成功")
	}
}
